﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CubicFWNet.Data.Models;
using CubicFWNet.Data.ViewModal;

namespace CubicFWNet.Data.SystemManager
{
    public class PurchasePrintRepository : RepositoryBase<PurchasePrint>
    {
        public IQueryable<OrderView> GetListPurchasePrint(string supplierName)
        {
            var result = from pp in dbcontext.PurchasePrints
                         join customer in dbcontext.Customers
                         on pp.SupplierId equals customer.Id
                         where customer.Name.Contains(supplierName)
                         select new OrderView
                        {
                            Id = pp.Id,
                            SupplierName = customer.Name,
                            SupplierId = customer.Id,
                            CreateTime = pp.CreateTime,
                            Status = pp.Status
                        };
            return result;
        }

    }
}
